# -*- coding: utf-8 -*-
# @Time    : 2021/10/28 13:55
# @Author  : Wan Fangming
import pandas as pd
import matplotlib.pylab as plt
import lightgbm as lgb

# read data
train = pd.read_csv('E:\Data\predicitivemaintance_processed.csv')

lgb_params = {
    'boosting_type': 'gbdt',
    'objective': 'binary',
    'num_leaves': 30,
    'num_round': 360,
    'max_depth': 8,
    'learning_rate': 0.01,
    'feature_fraction': 0.5,
    'bagging_fraction': 0.8,
    'bagging_freq': 12
}
lgb_train = lgb.Dataset(train.drop(target, 1), train[target])
model = lgb.train(lgb_params, lgb_train)
plt.figure(figsize=(12, 6))
lgb.plot_importance(model, max_num_features=30)
plt.title("Featurertances")
plt.show()
